package icmp

import (
	"encoding/binary"
)

type ICMPv4 []byte

const (
	Type     = 0
	Code     = 1
	Checksum = 2
)

// ICMP Type
const (
	PingType byte = 8
	PongType byte = 0

	ZeroCode byte = 0
)

func (i ICMPv4) Type() uint8 {
	return i[Type]
}

func (i ICMPv4) Code() uint8 {
	return i[Code]
}

func (i ICMPv4) Checksum() uint16 {
	return binary.BigEndian.Uint16(i[Checksum:])
}
